﻿using Microsoft.Extensions.Logging;
using NetCore.IRepository.Productionproductinfo;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace NetCore.Repository.Productionproductinfo
{
    public class Productionproductinfo : BaseRepository<NetCore.Model.Enity.Productionproductinfo>, IProductionproductinfo
    {
        private readonly ILogger<Productionproductinfo> _logger;

        public Productionproductinfo(ILogger<Productionproductinfo> Logger)
        {
            _logger = Logger;
        }

        /// <summary>
        /// 获取所有产品信息
        /// </summary>
        /// <returns></returns>
        public async Task<List<Model.Enity.Productionproductinfo>> GetProductionproductinfos()
        {
            List<Model.Enity.Productionproductinfo> productionproductinfos = new List<Model.Enity.Productionproductinfo>();
            try
            {
                productionproductinfos = await Db.Queryable<Model.Enity.Productionproductinfo>().ToListAsync();
                return productionproductinfos;
            }
            catch(Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                return productionproductinfos;
            }
        }
    }
}